import { request } from '@umijs/max';
import { PageResponse } from './index';
import { FileDetail } from './index';

export interface CelebrityStageCutInfoAddRequest {
    stageName: string;
    eventName: string;
    description: string;
    videoId: number;
    thumbnailId: string;
    tags: string;
    cr: string;
    downloadable: number;
    uploadDate: string;
    famousPersonId: number;
}

export interface CelebrityStageCutInfoUpdateRequest extends CelebrityStageCutInfoAddRequest {
    id: number;
}

export interface CelebrityStageCutInfoPageRequest {
    pageCurrent: number;
    pageSize: number;
    famousPersonId: number;
    keyword?: string;
}

export interface CelebrityStageCutInfo {
    id: number;
    stageName: string;
    eventName: string;
    description: string;
    videoInfo: FileDetail;
    thumbnailId: string;
    thumbnailUrl: string;
    tags: string;
    cr: string;
    downloadable: number;
    uploadDate: string;
    famousPersonId: number;
    views: number;
    duration: string;
    durationStr: string;
}

// 新增
export async function addCelebrityStageCutInfo(data: Omit<CelebrityStageCutInfo, 'id'>) {
    return request('/celebrity-stage-cut-info/back', {
        method: 'POST',
        data,
    });
}

// 更新
export async function updateCelebrityStageCutInfo(data: CelebrityStageCutInfo) {
    return request('/celebrity-stage-cut-info/back', {
        method: 'PUT',
        data,
    });
}

// 删除
export async function deleteCelebrityStageCutInfo(idList: number[]) {
    const ids = idList.join(',');
    return request(`/celebrity-stage-cut-info/back/${ids}`, {
        method: 'DELETE',
    });
}
// 分页查询
export async function getCelebrityStageCutInfoPage(params: CelebrityStageCutInfoPageRequest) {
    return request<PageResponse<CelebrityStageCutInfo>>('/celebrity-stage-cut-info/page', {
        method: 'POST',
        data: params,
    });
}

// 根据id查询
export async function getCelebrityStageCutInfoById(id: number) {
    return request<CelebrityStageCutInfo>(`/celebrity-stage-cut-info/${id}`, {
        method: 'GET',
    });
}

